//
//  NSNotifiVC.m
//  kvo
//
//  Created by YuanJiang on 2019/9/5.
//  Copyright © 2019 llbt. All rights reserved.
//

#import "NSNotifiVC.h"
#import "NSNotifiSecondVC.h"

#define kNotificationIdentifer @"notificationIdentifer"

@interface NSNotifiVC ()

@end

@implementation NSNotifiVC

- (void)viewDidLoad {
    [super viewDidLoad];

    //添加一个通知 获取从别的界面传过来的信息
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(passValue:) name:kNotificationIdentifer object:nil];
}

-(void)passValue:(NSNotification *)nofi
{
    NSLog(@"title is=======%@",[nofi.userInfo objectForKey:@"title"]);
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    NSNotifiSecondVC *vc = [[NSNotifiSecondVC alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

@end
